/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package koor.action.user;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import koor.action.Action;
import koor.action.ActionResult;
import koor.entity.User;
import koor.persistent.UserDAO;
import koor.service.ServiceLocator;

/**
 * The
 * <code>UserListAction</code> class represents admin action,
 * used to view user list
 *
 * @author Admin
 */
public class UserListAction implements Action {

    @Override
    public String getName() {
        return "user.list";
    }

    @Override
    public ActionResult execute(HttpServletRequest request, HttpServletResponse response) {
        List<User> employeeList = ServiceLocator.getService(UserDAO.class).findAll();
        request.setAttribute("userList", employeeList);
        return ActionResult.forward("UserView/UserListView.jsp");
    }
}
